// pages/activity_list/activity_list.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    activity_list:[],
    selected2: false,
    selected3: false,
    selected1: true,
    selected4: false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //console.log(options)
    if (options.selected1=='true'){
      this.selected()
    } else if (options.selected2 == 'true'){
      this.selected1()
    } else if (options.selected3 == 'true') {
      this.selected2()
    }else{
      this.selected3()
    }
    var that = this;
    
    //console.log(that.data)
    wx.request({
      url: "https://miniapp.odeman.com/summercamp/active_list.php",
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
       // console.log(res)
        that.setData({
          activity_list: res.data
        })
      }
    })
  },
  //夏令营点击跳转
  navUrl: function (e) {
    var ids = event.target;
    wx.navigateTo({
      url: '../activity_detail/activity_detail?id=' + ids,
    })
  },
  selected: function (e) {
    this.setData({
      selected2: false,
      selected3: false,
      selected1: true,
      selected4: false,
    })
  },
  selected1: function (e) {
    this.setData({
      selected1: false,
      selected3: false,
      selected2: true,
      selected4: false,
    })
  },
  selected2: function (e) {
    this.setData({
      selected1: false,
      selected2: false,
      selected3: true,
      selected4: false,
    })
  },
  selected3: function (e) {
    this.setData({
      selected1: false,
      selected2: false,
      selected3: false,
      selected4: true,
    })
  },
  onShareAppMessage: function () {
    return {
      title: '奥德曼夏令营',
    }
  },
  footerNav: function (e) {
 
    var id = e.currentTarget.dataset.id;
    if (id == 1) {
      wx.navigateTo({
        url: '../index_index/index_index?areaid=' + areaid,
      })
    } else if (id == 2) {
      wx.navigateTo({
        url: '../activity_list/activity_list?areaid=' + areaid,
      })
    } else {
      wx.navigateTo({
        url: '../user/user?areaid=' + areaid + '&userid=' +  wx.getStorageSync('userid'),
      })
    }

  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})